import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    user: null,
    isLogin: true,
    enabledAddons: {},
    enabledAddonsCount: 0,
    editorKey: null,
  },
  getters: {
  },
  mutations: {
    loginHandle(state, user) {
      state.user = user;
      state.isLogin = false;
    },
    logOut(state) {
      state.user = null;
      state.isLogin = false;
    },
    setEnabledAddons(state, addons, count) {
      state.enabledAddons = addons;
      state.enabledAddonsCount = count;
    },
    saveEditorKey(state, editorKey) {
      state.editorKey = editorKey;
    },
  },
  actions: {
  },
  modules: {
  },
});
